#ifndef __TEXTURE_H
#define __TEXTURE_H

/*
	TEXTURE.H

	The CTexture class
	OpenGL Game Programming
	Author: Kevin Hawkins
	Date: 3/29/2001
	Description: The CTexture class represents a single texture
			   object in the engine. To load a texture,
			   you only need to call the LoadTexture() function.

	Modificado por: José Mª Arnau
	Fecha: 11/09/2006

*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <SDL/SDL.h>
#include <SDL_image/SDL_image.h>

class CTexture
{
public:
	int width;
	int height;
	int bitDepth;
	unsigned int texID;

	SDL_Surface *image;
	GLubyte *data;

	CTexture() { data = NULL; image = NULL; }
	~CTexture() { Unload(); }

	Uint32 getpixel(SDL_Surface *surface, int x, int y);
	void LoadTexture(char *filename);
	void Unload()
	{
		glDeleteTextures(1, &texID);
			
		if (image)
			SDL_FreeSurface(image);

		if (data)
			delete data;

		image = NULL;
		data  = NULL;
	}
};

#endif
